*************************************************************************************
*																					*
*Campaign Panel Book Do-File Chapter 2 - Evaluation of political (media-)events 	*
*																					*
*************************************************************************************


*--------------------------------
* Evaluation TV-duel performance
*---------------------------------

* Merkel
gen a_duell_merk6 = (5-a_kp6_1810)/4
replace a_duell_merk6 = . if a_kp6_1810 == . | a_kp6_1810 == 99 | ///
	a_kp6_1810 == 100
tab a_duell_merk6 a_kp6_1810, m

gen b_duell_merk6 = (5-b_kp6_1810)/4
replace b_duell_merk6 = . if b_kp6_1810 == . | b_kp6_1810 == .a | ///
	b_kp6_1810 == .c | b_kp6_1810 == .e | b_kp6_1810 == .g
lab var b_duell_merk6 "TV-Duell 2013: Wahrgenommener Ausgang Merkel"

* Steinbrück
gen a_duell_stein6 = (5-a_kp6_1820)/4
replace a_duell_stein6 = . if a_kp6_1820 == . | a_kp6_1820 ==99 | ///
	a_kp6_1820 == 100
lab var a_duell_stein6 "TV-Duell 2009: Wahrgenommener Ausgang Steinmeier"

tab a_duell_stein6 a_kp6_1820, m

gen b_duell_stein6 =(5-b_kp6_1820)/4
replace b_duell_stein6 = . if b_kp6_1820 == . | b_kp6_1820 == .a | ///
	b_kp6_1820 == .c | b_kp6_1820 == .e | b_kp6_1820 == .g
lab var b_duell_stein6 "TV-Duell 2013: Wahrgenommener Ausgang Steinmeier"

sum *duell*

estimates clear
foreach year in a b {
eststo: reg `year'_duell_merk6 `year'_pidcdu1 `year'_pidspd1 `year'_pidgru1 `year'_pidfdp1 ///
	`year'_pidlink1
eststo: reg `year'_duell_stein6 `year'_pidcdu1 `year'_pidspd1 `year'_pidgru1 `year'_pidfdp1 ///
	`year'_pidlink1		
}


esttab using "Tables/Bewertung Ereignisse.rtf", b(2) se(2) r2(2) rename(b_pidcdu1 a_pidcdu1 ///
	b_pidspd1 a_pidspd1 b_pidgru1 a_pidgru1 b_pidfdp1 a_pidfdp1 ///
	b_pidlink1 a_pidlink1) mgroups("2009" "2013", pattern(1 0 1 0 ))  replace


*---------------------------------------
* Evaluation election-arena performance
*------------------------------------------

* Merkel
gen b_arena_merk6_a = (5-b_kp6_2990a)/4
replace b_arena_merk6_a = . if b_kp6_2990a == . | b_kp6_2990a == .a | ///
	b_kp6_2990a == .c | b_kp6_2990a == .e | b_kp6_2990a == .g
lab var b_arena_merk6_a "Wahlarena 2013: Wahrgenommener Ausgang Merkel"
tab b_arena_merk6 b_kp6_2990a, m

* Steinbrück
gen b_arena_stein6_a = (5-b_kp6_2990b)/4
replace b_arena_stein6_a = . if b_kp6_2990b == . | b_kp6_2990b == .a | ///
	b_kp6_2990b == .c | b_kp6_2990b == .e | b_kp6_2990b == .g
lab var b_arena_stein6_a "Wahlarena 2013: Wahrgenommener Ausgang Steinbrueck"

estimates clear
eststo: reg b_arena_merk6_a b_pidcdu1 b_pidspd1 b_pidgru1 b_pidfdp1 ///
	b_pidlink1
eststo: reg b_arena_stein6_a b_pidcdu1 b_pidspd1 b_pidgru1 b_pidfdp1 ///
	b_pidlink1
esttab using "Tables/Bewertung Ereignisse.rtf", ///
	b(2) se(2) r2(2) append

*-------------------------------------------------
* Evaluation of the economy
*-------------------------------------------------

* General economic situation

fre ?_kp?_820 

foreach num of numlist 1 3 5 7 {
gen a_allwilag`num' = a_kp`num'_820
recode a_allwilag`num' (1=1) (2=0.75) (3=0.5) (4=0.25) (5=0) (99=.)
lab var a_allwilag`num' "Allgemeine Wirtschaftslage, aktuell"
}


foreach num of numlist 1 4 7 {
gen b_allwilag`num' = b_kp`num'_820
recode b_allwilag`num' (1=1) (2=0.75) (3=0.5) (4=0.25) (5=0) (99=.)
lab var b_allwilag`num' "Allgemeine Wirtschaftslage, aktuell"
}




*---------------------------------------------------
* Evaluation political events
*---------------------------------------------------

* Valuelabels for almost all events
lab define zustimm ///
	0 "trifft überhaupt nicht zu" ///
	1 "trifft voll und ganz zu" ///
	.a "Keine Angabe" ///
	.e "Nicht teilgenommen" ///
	.g "Interview abgebrochen"

* phone-bugging scandal
fre b_kp?_2900a
foreach welle of numlist 2/7 {
      gen b_nsa_handling`welle' = (b_kp`welle'_2900a-1)/4 	//Merkel reacts adequately
	  gen b_nsa_regknow`welle' = (b_kp`welle'_2900b-1)/4		//BR new about it
	  gen b_nsa_oppknow`partei'`welle' = (b_kp`welle'_2900c-1)/4 	//Opposition new about it
 }

   
foreach welle of numlist 2 5 {
gen b_nsa_apologet`welle' = (b_kp`welle'_2900f-1)/4 		//who does not have to hide anything
}

gen b_nsa_rotgrün4 = (b_kp4_2900h-1)/4				//Red-Green enabled NSA-colaboration 

foreach welle of numlist 2 5 6 7 {
gen b_nsa_fatal`welle' = (b_kp`welle'_2900e-1)/4 				//the German state cannot do anything
}

lab val b_nsa* zustimm

fre b_nsa_handling2

* Wulff-Strafprozess
gen b_wulff5 = (b_kp5_2910d-1)/4  //criminal case legitimate
lab val b_wulff5 zustimm

* Drone affair
fre *kp?_2920c
gen b_drohne_unwahrheit3 = (b_kp3_2920a-1)/4		//De Maizière lied
gen b_drohne_handling3 = (b_kp3_2920b-1)/4		//Merkel reacted appropriately
gen b_drohne_rücktritt3 = (b_kp3_2920c-1)/4		//De Maizière should resign as minister

lab val *nsa* *wulff* *drohne* zustimm				

* middle-finger (flip so. the bird) 
lab define problem ///
	0 "überhaupt nicht problematisch" ///
	1 "sehr problematisch", replace
	
foreach welle of numlist 6/7 {
	gen b_mittelfinger`welle' = (5-b_kp`welle'_4031)/4	//from not at all problematic to highly problematic
	gen b_donknow_mittelfinger`welle' = ///
	     b_kp`welle'_4030==3  // in case of nothing seen
	replace b_donknow_mittelfinger`welle' = . if b_kp`welle'_4030>3
   }
lab val b_mittelfinger? problem

fre *mittel*
tab b_donknow*7 b_kp7_4030, m



* Paedophilia 
foreach welle of numlist 7 {
      gen b_paed`welle' = (b_kp7_4040-1)/4  //Trittin unacceptable
	  lab var b_paed`welle' "Trittin unzumutbar Pädophilie"
	  lab val b_paed`welle' zustimm
   }

  tab b_paed7 b_pidgru1, col 
 

* Syria
foreach welle of numlist 5/7 {
    gen b_syria_handling`welle' = (b_kp`welle'_2970c-1)/4  //Merkel reacted appropriately
	lab val b_syria_handling`welle' zustimm
	  }


* Credibility Steinbrück rejection Red/Red/Green 
foreach welle of numlist 3 5 6 {
     gen b_glaubw_rrg`welle'=(5-b_kp`welle'_2930)/4
	 lab var b_glaubw_rrg`welle' ///
		"Glübwürdigkeit Steinbrück Ablehnung Rot/Rot/Grün"
	lab val b_glaubw_rrg`welle' zustimm
 }
 
 
  /* Vegetarian Day and road toll were not really events,
  but rather widely discussed campaign demands made by the parties */
 
* Veggie-Day 
   foreach welle of numlist 4 6 7 {
      gen b_veggie`welle' = (b_kp`welle'_2940b-1)/4
	  lab val b_veggie`welle' zustimm
	  
}

* road toll
   foreach welle of numlist 4 6 7 {
      gen b_maut`welle' = (b_kp`welle'_2940a-1)/4
	  lab val b_maut`welle' zustimm
	  
}
 
 
sum b_nsa_handling2-b_maut7 //check valuerange



